package com.rockcent.mall.lib.domain;

import com.rockcent.common.domain.IDEntityMall;
import com.rockcent.mall.lib.domain.enumclass.SysPermissionType;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;

/**
 * Created by zhangjh on 2016/12/12.
 * 系统权限表
 */
@Entity
@Table(name = "sys_permission")
@DynamicInsert
@DynamicUpdate
public class SysPermission extends IDEntityMall {

    public static final String MALL_SUPPER_ADMIN = "MALL_SUPPER_ADMIN";
    public static final String MERCHANT_SUPPER_ADMIN = "MERCHANT_SUPPER_ADMIN";

    @Column(columnDefinition = "varchar(50) comment '功能名称'")
    private String name;
    @Column(columnDefinition = "varchar(500) comment '访问URL 当类型为default时为系统权限，目前有两种：MALL_SUPPER_ADMIN(\"平台超级管理员权限\"),MERCHANT_SUPPER_ADMIN(\"商户超级管理员权限\")'")
    private String url;
    @Column(columnDefinition = "varchar(50) comment '类型 DEFAULT(\"系统默认\"), CUSTOMER(\"自定义\")'")
    @Enumerated(EnumType.STRING)
    private SysPermissionType type;
    @Column(columnDefinition = "bigint comment '平台id 系统权限 mallId = 0'")
    private Long mallId = 0L;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public SysPermissionType getType() {
        return type;
    }

    public void setType(SysPermissionType type) {
        this.type = type;
    }

    public Long getMallId() {
        return mallId;
    }

    public void setMallId(Long mallId) {
        this.mallId = mallId;
    }

    @Override
    public String toString() {
        return "SysPermission{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", dateCreated=" + dateCreated +
                ", url='" + url + '\'' +
                ", lastUpdated=" + lastUpdated +
                ", isDelete=" + isDelete +
                ", type=" + type +
                ", version=" + version +
                ", mallId=" + mallId +
                '}';
    }
}
